/**************************************************************************//**
\file  uv.h

\brief Interface to the UV sensor.

\author
    Satxo

\internal
  History:
    05/08/12 R. Rodrigues - Created
******************************************************************************/

#ifndef _UV_H
#define _UV_H

/******************************************************************************
                   Includes section
******************************************************************************/
// \cond
#include <types.h>
#include <sensors.h>
// \endcond

/******************************************************************************
                   Types section
******************************************************************************/
// states
typedef enum
{
  UV_IDLE,					// idle
  UV_RETURN,				// return to top layer task handler
  UV_WAIT,					// delay
  UV_GET_UV,
  UV_FORMAT_HUMIDITY
} UVStates_t;

// Control structure
typedef struct  {
	uint16_t uvData;								// Contains the result of sampling
	bool uvResult;									// return value BC_SUCCESS/BC_FAIL
	void(* uvCallback)(bool error, uint16_t data);	// callback
} UVControl_t;

/******************************************************************************
                   Prototypes section
******************************************************************************/
/**************************************************************************//**
\brief  Opens the component to use.

\return
  BC_SUCCESS - the component is ready to been use.
  BC_FAIL - otherwise.

******************************************************************************/
result_t openUV(void);

/**************************************************************************//**
\brief  Performs the test if the component have completed request.

\return
  BC_FAIL - the previous request is not completed.
  BC_SUCCESS - otherwise.
******************************************************************************/
result_t closeUV(void);

/**************************************************************************//**
\brief Reads the UV value.
******************************************************************************/
result_t readUVData(void (*f)(bool result, uint16_t data));

#endif /* _UV_H */
// eof uv.h
